Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for fine-grained error location lines in Python tracebacks #334

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

msrb
Copy link
Member

@msrb msrb commented Oct 29, 2022

See: PEP 657

Python 3.11 makes it easier to identify where on the line a problem occurred. This is achieved with the error location lines. We need to skip such lines when parsing the traceback, otherwise we won't identify the exception name correctly (See: rhbz#2137473).

Example:

Traceback (most recent call last):
File "test.py", line 2, in
x['a']['b']['c']['d'] = 1
~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable

Signed-off-by: Michal Srb [email protected]

See: PEP 657

Python 3.11 makes it easier to identify where on the line a problem
occurred. This is achieved with the error location lines.
We need to skip such lines when parsing the traceback, otherwise
we won't identify the exception name correctly (See: rhbz#2137473).

Example:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    x['a']['b']['c']['d'] = 1
    ~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable

Signed-off-by: Michal Srb <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Merging #334 (52a861d) into master (7e20e30) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #334      +/-   ##
==========================================
- Coverage   63.13%   63.13%   -0.01%     
==========================================
  Files          40       40              
  Lines        7352     7351       -1     
  Branches     1232     1232              
==========================================
- Hits         4642     4641       -1     
  Misses       2180     2180              
  Partials      530      530              
Impacted Files Coverage Δ
lib/python_stacktrace.c 41.93% <ø> (-5.13%) ⬇️
lib/python_frame.c 58.48% <100.00%> (+2.14%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@mgrabovsky mgrabovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@mgrabovsky mgrabovsky merged commit 8143690 into abrt:master Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants